A Case of Visitor versus Interpreter Pattern

نویسندگان

  • Mark Hills
  • Paul Klint
  • Tijs van der Storm
  • Jurgen J. Vinju
چکیده

We compare the Visitor pattern with the Interpreter pattern, investigating a single case in point for the Java language. We have produced and compared two versions of an interpreter for a programming language. The first version makes use of the Visitor pattern. The second version was obtained by using an automated refactoring to transform uses of the Visitor pattern to uses of the Interpreter pattern. We compare these two nearly equivalent versions on their maintenance characteristics and execution efficiency. Using a tailored experimental research method we can highlight differences and the causes thereof. The contributions of this paper are that it isolates the choice between Visitor and Interpreter in a realistic software project and makes the difference experimentally observable.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Using Generative Programming to Enhance Reuse in Visitor Pattern-based DSML Model Interpreters

An important part of domain-specific modeling language (DSML) tools is model interpretation – the translation of constructed models into useful artifacts, such as dense XML configuration files or source files, or other model representations. When the same DSML is used for different purposes, e.g., generating metadata for platform deployment or performance analysis, or creating composite DSMLs, ...

متن کامل

The Debuggable Interpreter Design Pattern

The use of Interpreter and Visitor design patterns has been widely adopted to implement programming language interpreters due to their expressive and simple design. However, no general approach to conceive a debugger is commonly adopted. This paper presents the debuggable interpreter design pattern as a general approach to extend a language interpreter with debugging facilities such as step-ove...

متن کامل

Mapping and Visiting in Functional and Object-Oriented Programming

class Exp{public abstract T Accept(Visitor v, D x);}class PlusExp : Exp {private Exp e1, e2;public PlusExp(Exp a, Exp b){e1 = a;e2 = b;}public Exp LeftOperand{get {return e1;}}public Exp RightOperand{get {return e2;}}public override T Accept(Visitor v, D x){return v.Visit(this, x);}} class TimesExp : Exp {private Ex...

متن کامل

Description of Semantics and Code Generation Possibilities for a Multi-Language Interpreter

In this paper we describe the definition of semantics for a Multi-Language interpreter (MLI), which provides the execution of the given program, receiving and exploiting corresponding language syntax and the desired semantics. We analyze the simplest solution – the MLI receives the language syntax and the semantics descriptions, which have already been compiled to executable objects. Semantics ...

متن کامل

Building Program Understanding Tools Using Visitor Combinators

Program understanding tools manipulate program representations, such as abstract syntax trees, control-flow graphs, or data-flow graphs. This paper deals with the use of visitor combinators to conduct such manipulations. Visitor combinators are an extension of the well-known visitor design pattern. They are small, reusable classes that carry out specific visiting steps. They can be composed in ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2011